<?php
/**
 * Created by PhpStorm.
 * User: zg
 * Date: 18-8-7
 * Time: 下午3:53
 */

namespace app\index\controller;
use think\Db;

class Product extends Base
{
    public function index()
    {
        $id = input('id');

        //获取banner
        $banner = Db::name('product_banner')->where('id',$id)->find();

        $this->assign('banner',$banner);

        //获取产品
        $pro = Db::name('product')->where('id',$id)->find();

        $this->assign('pro',$pro);

        //服务流程
        $step = Db::name('product_step')->where('pid',$id)->order('sort asc')->select();

        $this->assign('step',$step);

        //区块一
        $q1 = Db::name('product_resource')->where(['pid'=>$id,'type'=>'wait'])->find();

        //区块二
        $q2 = Db::name('product_resource')->where(['pid'=>$id,'type'=>'get'])->find();

        $this->assign('q1',$q1);
        $this->assign('q2',$q2);

        //还需要做的
        $need = Db::name('product_other')->where('pid',$id)->order('sort')->select();
        $this->assign('need',$need);

        //推荐产品
        $tui = Db::name('product')->where('is_tuijian','1')->select();
        $this->assign('tui',$tui);

        return $this->fetch();
    }

}